package com.reyco1.medusa.display.graphics
{
	import com.reyco1.medusa.display.SmartSprite;
	
	import flash.display.Graphics;
	import flash.geom.Point;

	public class Triangle
	{
		public static function draw(a:Point, b:Point, c:Point, fillColor:uint = 0x000000, 
									fillAlpha:int = 1, lineObject:Object = null):SmartSprite
		{
			var s:SmartSprite = new SmartSprite();
			var g:Graphics = s.graphics;
			
			g.clear();
			g.beginFill(fillColor, fillAlpha);
			if(lineObject)
			{
				var thickness:Number = lineObject.thickness == undefined ? null : lineObject.thickness;
				var lineAlpha:Number = lineObject.alpha == undefined ? 1 : lineObject.alpha;
				var lineColor:Number = lineObject.color == undefined ? 0 : lineObject.color;
				s.graphics.lineStyle(thickness, lineColor, lineAlpha);
			}
			g.moveTo(a.x, a.y);
			g.lineTo(b.x, b.y);
			g.lineTo(c.x, c.y);
			g.lineTo(a.x, a.y);
			g.endFill();
			
			return s;
		}
	}
}